package com.leng.asynchronous.controller;

import com.leng.common.core.ApiResult;
import com.leng.logger.admin.service.IAdminLogininforService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class TestController {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private IAdminLogininforService adminLogininforService ;

    @GetMapping("test/{string}")
    public String test(@PathVariable String string) {
        return restTemplate.getForObject("http://SPRING-CLOUD-NAOCS/test/" + string, String.class);
    }

    @GetMapping("test2/{string}")
    public String test(@PathVariable Integer string) {
        return restTemplate.getForObject("http://SPRING-CLOUD-NAOCS/test2/" + string, String.class);
    }

    @GetMapping("/list")
    public ApiResult list(){
        return ApiResult.success(adminLogininforService.list()) ;
    }
}
